% Common preamble used by the manuals
\documentclass[twoside,11pt]{../sty/report_petsc}

\usepackage{geometry}
\usepackage{fixltx2e}
\usepackage{makeidx,xspace}
\usepackage[bookmarksopen,colorlinks]{hyperref}
\usepackage[all]{hypcap}
\usepackage{xcolor}
\input pdfcolor.tex

\usepackage[pdftex]{graphicx}

%\usepackage{times}
\usepackage{tikz}
\usepackage{../sty/verbatim}
\usepackage{../sty/tpage}
\usepackage{../sty/here}
\usepackage{../sty/anlhelper}

% At the time of this writing, only used for \text{} in math mode
\usepackage{amsmath}

% trl is used to refer to URLs, command line arguments, paths, and other "mentions"
%\usepackage[obeyspaces]{../sty/trl}
\usepackage[hyphens,spaces,obeyspaces]{../sty/trl}

% Listings are used to refer to literal code
\usepackage{listings}
\usepackage{xcolor}
\definecolor{verylightgray}{gray}{0.95}
\definecolor{somewhatdarkgray}{gray}{0.3}

% General/default listing settings are for C code

% Note : $ (not used in C) is an escape character,
% so using this for languages that include this will give some
% strange errors as you escape to LaTeX

% Note : When using \lstinline inside a table,
% use pipes as delimiters, like \lstinline|VecCopy()|
% This is hardcoded into lib/petsc/bin/maint/mapnameslatex.py
\lstset{
  language=C,
  basicstyle=\normalsize\ttfamily,
  escapechar=\$,        % Also hardcoded in lib/petsc/bin/maint/mapnameslatex.py
  commentstyle=\color{somewhatdarkgray}\ttfamily,
  showstringspaces=false,
  basewidth=0.5em,      % For consistent spacing with inline listings
  breaklines=true,
  backgroundcolor=\color{verylightgray},
  frame=single,
  framexleftmargin= 3px,
  framexrightmargin= 3px,
  rulecolor=\color{lightgray},
  breakatwhitespace=true,
}

% Some special listing environments for various code types
% We could consider using a dedicated clisting (but be careful with the inline listings)

\lstnewenvironment{outputlisting}[1][\footnotesize\ttfamily]
{\lstset{escapechar=,language=,basicstyle=#1,breakatwhitespace=false}}
{}

\lstnewenvironment{bashlisting}
{\lstset{escapechar=,language=bash,basicstyle=\ttfamily}}
{}

\lstnewenvironment{makelisting}
{\lstset{escapechar=,language=make,basicstyle=\ttfamily}}
{}

\usepackage{color}
\definecolor{deepblue}{rgb}{0,0,0.5}
\definecolor{deepred}{rgb}{0.6,0,0}
\definecolor{deepgreen}{rgb}{0,0.5,0}

% Default fixed font does not support bold face
\DeclareFixedFont{\ttb}{T1}{cmtt}{bx}{n}{10} % for bold
\DeclareFixedFont{\ttm}{T1}{cmtt}{m}{n}{10}  % for normal
\DeclareFixedFont{\sttb}{T1}{cmtt}{bx}{n}{8} % for bold
\DeclareFixedFont{\sttm}{T1}{cmtt}{m}{n}{8}  % for normal

\lstnewenvironment{pythonlisting}
{\lstset{
language=Python,
basicstyle=\sttm,
otherkeywords={self},             % Add keywords here
keywordstyle=\sttb\color{deepblue},
emph={MyClass,__init__},          % Custom highlighting
emphstyle=\sttb\color{deepred},    % Custom highlighting style
commentstyle=\sttm\color{deepgreen},
frame=tb,                         % Any extra options here
showstringspaces=false,           %
columns=fullflexible              % Necessary for proper cut/paste
}}
{}

% Set all nested itemize labels to be the same
\renewcommand{\labelitemi}{$\bullet$}
\renewcommand{\labelitemii}{$\bullet$}
\renewcommand{\labelitemiii}{$\bullet$}
\renewcommand{\labelitemiv}{$\bullet$}

% Define a tighter itemize and enumerate
% To be used when all entries are a single line.
\newenvironment{tightitemize}
{ \begin{itemize}
  \setlength{\itemsep}{1pt}
  \setlength{\parskip}{1pt}
  \setlength{\parsep}{1pt} }
{ \end{itemize} }
\newenvironment{tightenumerate}
{ \begin{enumerate}
  \setlength{\itemsep}{1pt}
  \setlength{\parskip}{1pt}
  \setlength{\parsep}{1pt} }
{ \end{enumerate} }

\setlength{\textwidth}{6.5in}
\setlength{\oddsidemargin}{0.0in}
\setlength{\evensidemargin}{0.0in}
\setlength{\textheight}{9.2in}
\setlength{\topmargin}{-.8in}

\newcommand{\findex}[1]{\index{#1}}
\newcommand{\sindex}[1]{\index{#1}}
\newcommand{\A}{\mbox{\boldmath \(A\)}}
\newcommand{\F}{\mbox{\boldmath \(F\)}}
\newcommand{\J}{\mbox{\boldmath \(J\)}}
\newcommand{\x}{\mbox{\boldmath \(x\)}}
\newcommand{\bb}{\mbox{\boldmath \(b\)}}
\newcommand{\rr}{\mbox{\boldmath \(r\)}}

\usepackage{fancyhdr,lastpage}
